/* components */
import TaskReviewListData from '@src/modules/task/taskTypes/review/TaskReviewListData'
/* enum */
import AuthEnum from '@model/enum/AuthEnum'
/* model */
import { EvaluateValueEnum, ReviewTypeValueEnum, ReviewValueEnum } from '@src/modules/task/taskTypes/review/TaskReviewListModel'
/* util */
import AuthUtil from '@src/util/auth'
import { isBasicEditionHideSubscribe, isBasicEditionHidePart, isBasicEditionHideServe } from '@shb-lib/version'
import { getRootWindow } from '@src/util/dom'

class TaskReviewListComputed extends TaskReviewListData {
  
  /**
   * @description 是否为自动回访
   * @return {Boolean}
   */
  get isAutoReview(): boolean {
    return this.reviewType === ReviewTypeValueEnum.Auto
  }

  /**
   * @description 是否为人工回访
   * @return {Boolean}
   */
  get isManualReview(): boolean {
    return this.reviewType === ReviewTypeValueEnum.Manual
  }

  /**
   * @description 是否为回访全部
   * @return {Boolean}
   */
  get isReviewAll(): boolean {
    return this.reviewValue === ReviewValueEnum.All
  }

  /**
   * @description 是否为已回访
   * @return {Boolean}
   */
  get isReviewed(): boolean {
    return this.reviewValue === ReviewValueEnum.Reviewed
  }

  /**
   * @description 是否为未回访
   * @return {Boolean}
   */
  get isUnReview(): boolean {
    return this.reviewValue === ReviewValueEnum.UnReview
  }

  /**
   * @description 是否为跟进中
   * @return {Boolean}
   */
  get isFollowUp(): boolean {
    return this.reviewValue === ReviewValueEnum.FollowUp
  }

  /**
   * @description 是否指派给我
   * @return {Boolean}
   */
  get isAssignToMe(): boolean {
    return this.reviewValue === ReviewValueEnum.AssignToMe
  }

  /**
   * @description 是否为评价全部
   * @return {Boolean}
   */
  get isEvaluateAll(): boolean {
    return this.evaluateValue === EvaluateValueEnum.All
  }

  /**
   * @description 是否为已评价
   * @return {Boolean}
   */
  get isEvaluated(): boolean {
    return this.evaluateValue === EvaluateValueEnum.Evaluated
  }

  /**
   * @description 是否为未评价
   * @return {Boolean}
   */
  get isUnEvaluate(): boolean {
    return this.evaluateValue === EvaluateValueEnum.UnEvaluate
  }

  /**
   * @description 是否显示操作按钮
   * @return {Boolean}
   */
  get isShowOperateButton(): boolean {
    return !(this.isAutoReview && this.isUnEvaluate)
  }

  /**
  * @description: 是否允许发送回访短信
  * @return {boolean}
  */
  get allowPayVisit(): boolean {
    return !!(this.auth?.[AuthEnum.SMS_CONFIG])
  }

  // 基础版功能是否隐藏订阅
  get isBasicEditionHideSubscribe(): boolean {
    return isBasicEditionHideSubscribe() 
  }

  // 基础版功能是否隐藏备件
  get isBasicEditionHidePart(): boolean {
    return isBasicEditionHidePart() 
  }

  // 基础版功能是否隐藏服务
  get isBasicEditionHideServe(): boolean {
    return isBasicEditionHideServe() 
  }

  get hasCallAuth(): boolean {
    return !!getRootWindow(window).CTI
  }

  // 满意度灰度
  get isSatisfaction():boolean {
    const RootWindow = getRootWindow(window);
    return RootWindow?.grayAuth?.satisfaction || false;
  }
}

export default TaskReviewListComputed
